/**
 * 错误边界组件样式
 * @description 自定义错误边界组件的样式定义
 */

.errorBoundary {
  /* 基础样式 */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background-color: #fafafa;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(120, 200, 255, 0.1) 0%, transparent 50%);
}

/* 错误详情容器 */
.errorDetails {
  width: 100%;
  max-width: 800px;
  margin-top: 32px;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* 错误内容 */
.errorContent {
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

/* 错误项 */
.errorItem {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.errorItem:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.errorItem :global(.ant-typography) {
  margin-bottom: 8px;
}

/* 堆栈跟踪样式 */
.stackTrace {
  max-height: 200px;
  overflow-y: auto;
  background-color: #f5f5f5;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 12px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Result组件样式覆盖 */
.errorBoundary :global(.ant-result) {
  padding: 48px 32px;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  max-width: 600px;
  width: 100%;
}

.errorBoundary :global(.ant-result-icon) {
  margin-bottom: 24px;
}

.errorBoundary :global(.ant-result-icon .anticon) {
  font-size: 72px;
  color: #ff4d4f;
}

.errorBoundary :global(.ant-result-title) {
  color: #262626;
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 16px;
}

.errorBoundary :global(.ant-result-subtitle) {
  color: #8c8c8c;
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 32px;
}

.errorBoundary :global(.ant-result-extra) {
  margin-top: 32px;
}

.errorBoundary :global(.ant-result-extra .ant-btn) {
  margin: 0 8px;
  min-width: 120px;
  height: 40px;
  border-radius: 6px;
  font-weight: 500;
}

/* 折叠面板样式 */
.errorDetails :global(.ant-collapse) {
  border: none;
  background: transparent;
}

.errorDetails :global(.ant-collapse-item) {
  border: none;
}

.errorDetails :global(.ant-collapse-header) {
  padding: 16px 20px;
  background-color: #f8f9fa;
  border-radius: 8px 8px 0 0;
  font-weight: 500;
  color: #595959;
}

.errorDetails :global(.ant-collapse-header:hover) {
  background-color: #e9ecef;
}

.errorDetails :global(.ant-collapse-content) {
  border: none;
  background-color: #ffffff;
}

.errorDetails :global(.ant-collapse-content-box) {
  padding: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .errorBoundary {
    padding: 20px 16px;
    min-height: 100vh;
  }

  .errorBoundary :global(.ant-result) {
    padding: 32px 20px;
    margin: 0;
  }

  .errorBoundary :global(.ant-result-icon .anticon) {
    font-size: 56px;
  }

  .errorBoundary :global(.ant-result-title) {
    font-size: 20px;
  }

  .errorBoundary :global(.ant-result-subtitle) {
    font-size: 14px;
  }

  .errorBoundary :global(.ant-result-extra .ant-btn) {
    margin: 4px;
    min-width: 100px;
    height: 36px;
  }

  .errorDetails {
    margin-top: 20px;
  }

  .errorContent {
    padding: 12px;
  }

  .stackTrace {
    font-size: 11px;
    padding: 8px;
  }
}

@media (max-width: 480px) {
  .errorBoundary {
    padding: 16px 12px;
  }

  .errorBoundary :global(.ant-result) {
    padding: 24px 16px;
  }

  .errorBoundary :global(.ant-result-icon .anticon) {
    font-size: 48px;
  }

  .errorBoundary :global(.ant-result-title) {
    font-size: 18px;
  }

  .errorBoundary :global(.ant-result-subtitle) {
    font-size: 13px;
  }

  .errorBoundary :global(.ant-result-extra) {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .errorBoundary :global(.ant-result-extra .ant-btn) {
    margin: 0;
    width: 100%;
  }

  .stackTrace {
    font-size: 10px;
    max-height: 150px;
  }
}

/* 深色主题适配 */
[data-theme='dark'] .errorBoundary {
  background-color: #141414;
}

[data-theme='dark'] .errorBoundary :global(.ant-result) {
  background-color: #1f1f1f;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] .errorBoundary :global(.ant-result-title) {
  color: #d9d9d9;
}

[data-theme='dark'] .errorBoundary :global(.ant-result-subtitle) {
  color: #8c8c8c;
}

[data-theme='dark'] .errorDetails {
  background-color: #1f1f1f;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] .errorContent {
  background-color: #1f1f1f;
}

[data-theme='dark'] .errorItem {
  border-bottom-color: #303030;
}

[data-theme='dark'] .stackTrace {
  background-color: #262626;
  border-color: #434343;
  color: #d9d9d9;
}

[data-theme='dark'] .errorDetails :global(.ant-collapse-header) {
  background-color: #262626;
  color: #d9d9d9;
}

[data-theme='dark'] .errorDetails :global(.ant-collapse-header:hover) {
  background-color: #303030;
}

[data-theme='dark'] .errorDetails :global(.ant-collapse-content) {
  background-color: #1f1f1f;
}

/* 动画效果 */
.errorBoundary {
  animation: errorFadeIn 0.5s ease-out;
}

@keyframes errorFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.errorBoundary :global(.ant-result-icon) {
  animation: errorIconPulse 2s ease-in-out infinite;
}

@keyframes errorIconPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* 错误详情展开动画 */
.errorDetails :global(.ant-collapse-content) {
  transition: all 0.3s ease;
}

/* 滚动条样式 */
.errorContent::-webkit-scrollbar,
.stackTrace::-webkit-scrollbar {
  width: 6px;
}

.errorContent::-webkit-scrollbar-track,
.stackTrace::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.errorContent::-webkit-scrollbar-thumb,
.stackTrace::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.errorContent::-webkit-scrollbar-thumb:hover,
.stackTrace::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

[data-theme='dark'] .errorContent::-webkit-scrollbar-track,
[data-theme='dark'] .stackTrace::-webkit-scrollbar-track {
  background: #262626;
}

[data-theme='dark'] .errorContent::-webkit-scrollbar-thumb,
[data-theme='dark'] .stackTrace::-webkit-scrollbar-thumb {
  background: #434343;
}

[data-theme='dark'] .errorContent::-webkit-scrollbar-thumb:hover,
[data-theme='dark'] .stackTrace::-webkit-scrollbar-thumb:hover {
  background: #595959;
}

/* 按钮悬停效果增强 */
.errorBoundary :global(.ant-btn) {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.errorBoundary :global(.ant-btn::before) {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
}

.errorBoundary :global(.ant-btn:hover::before) {
  width: 100%;
  height: 100%;
}

/* 紧凑模式 */
.errorBoundary.compact {
  padding: 20px 16px;
}

.errorBoundary.compact :global(.ant-result) {
  padding: 24px 20px;
}

.errorBoundary.compact :global(.ant-result-icon .anticon) {
  font-size: 56px;
}

.errorBoundary.compact .errorDetails {
  margin-top: 20px;
}

/* 全屏模式 */
.errorBoundary.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
}

[data-theme='dark'] .errorBoundary.fullscreen {
  background-color: rgba(20, 20, 20, 0.95);
}

/* 简洁模式 */
.errorBoundary.simple .errorDetails {
  display: none;
}

.errorBoundary.simple :global(.ant-result-extra .ant-btn:last-child) {
  display: none;
}